package com.etl.dataflow.scheduler.admin.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.etl.dataflow.scheduler.admin.validation.Add;
import com.etl.dataflow.scheduler.admin.validation.Update;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 任务运行统计信息
 * </p>
 *
 * @author dx
 * @since 2022-04-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("dataflow_task_statistic")
public class DataflowTaskStatistic implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键,使用ID_WORKER策略,全局唯一ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(groups = Update.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    /**
     * 任务运行记录id
     */
    @NotNull(groups = Add.class)
    @TableField("task_record_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long taskRecordId;

    /**
     * 源表数据量(行)
     */
    @NotNull(groups = Add.class)
    @TableField("src_row_number")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long srcRowNumber;

    /**
     * 已读数据量(行)
     */
    @NotNull(groups = Add.class)
    @TableField("red_row_number")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long redRowNumber;

    /**
     * 插入成功+失败数据量(行)
     */
    @NotNull(groups = Add.class)
    @TableField("processed_row_number")
    private Long processedRowNumber;

    /**
     * 插入成功数据量(行)
     */
    @NotNull(groups = Add.class)
    @TableField("written_row_number")
    private Long writtenRowNumber;

    /**
     * 读缓冲速度: 字节/s
     */
    @NotNull(groups = Add.class)
    @TableField("read_bytes_per_second")
    private Double readBytesPerSecond;

    /**
     * 读缓冲速度: 行/s
     */
    @NotNull(groups = Add.class)
    @TableField("read_rows_per_second")
    private Double readRowsPerSecond;

    /**
     * 写缓冲速度: 字节/s
     */
    @NotNull(groups = Add.class)
    @TableField("write_bytes_per_second")
    private Double writeBytesPerSecond;

    /**
     * 写缓冲速度: 行/s
     */
    @NotNull(groups = Add.class)
    @TableField("write_rows_per_second")
    private Double writeRowsPerSecond;

    /**
     * 每万行写缓冲阻塞时间(ns)
     */
    @NotNull(groups = Add.class)
    @TableField("write_block_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long writeBlockTime;

    /**
     * 每万行读缓冲阻塞时间(ns)
     */
    @NotNull(groups = Add.class)
    @TableField("read_block_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long readBlockTime;

    /**
     * 创建用户id
     */
    @TableField("creator_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long creatorId;

    /**
     * 插入时间
     */
    @TableField(value = "idt", fill = FieldFill.INSERT)
    private LocalDateTime idt;

    /**
     * 更新时间
     */
    @TableField(value = "udt", fill = FieldFill.UPDATE)
    private LocalDateTime udt;


}
